package com.es.servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * 描述:
 * es-servlet-
 *
 * @author Derek
 * 创建时间：2022-04-21 10:41
 */
@WebServlet(urlPatterns = "/c")
public class CServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //
        System.out.println("我是Cservlet");
        //进行重定向，是告诉浏览器一个新的请求地址
        String flag = "你好";
        //传值规则： 使用最小的范围
        req.setAttribute("flag", flag);

        resp.sendRedirect("d");
    }
}
